package com.sch.hsy.system.service.impl;

import com.sch.hsy.common.core.domain.entity.SysBook;
import com.sch.hsy.system.mapper.SysBookMapper;
import com.sch.hsy.system.service.ISysBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 书籍管理 服务实现
 */
@Service
public class SysBookServiceImpl implements ISysBookService {

    @Autowired
    private SysBookMapper sysBookMapper;

    /**
     * 查询书籍列表
     * @param sysBook
     * @return
     */
    @Override
    public List<SysBook> selectBookList(SysBook sysBook) {
        return sysBookMapper.selectBookList(sysBook);
    }

    /**
     * 添加书籍信息
     * @param sysBook
     * @return
     */
    @Override
    public int insertBook(SysBook sysBook) {
        int result = sysBookMapper.insertBook(sysBook);
        //插入年级与书籍关联信息表

        return result;
    }

    @Override
    public int deleteBookById(Long bookId) {
        return sysBookMapper.deleteBookById(bookId);
    }

    @Override
    public int deleteBookByIds(Long[] bookIds) {
        return sysBookMapper.deleteBookByIds(bookIds);
    }

    @Override
    public int selectBookCount() {
        return sysBookMapper.selectBookCount();
    }

    @Override
    public List<Map<String, Object>> selectBookClassify() {
        return sysBookMapper.selectBookClassify();
    }
}
